import axios from "axios";
import { Message } from 'element-ui';
 const ins = axios.create({
    // baseURL:process.env.NODE_ENV === "development" ? '/server' : '',
    baseURL:'http://192.168.1.204:3000/',
    headers: {
        'Content-Type': "application/json; charset=utf-8",
        "Access-Control-Allow-Origin": "*"
    }
 });

ins.interceptors.request.use(
    config => {
        return config;
    },
    err => {
        return Promise.reject(err);
    }
)

// 响应拦截器
ins.interceptors.response.use(
    res => {
        return res;
    },
    err => {
        if ("操作被用户取消" !== err.message) {
            Message({
                type: "error",
                message: "请求失败"
            });
            return Promise.reject(err);
        }
    }
);
export default ins;